vim9script noclear

export def GtagsAutoUpdate()
	if cscope_connection()
		job_start($'global -u --single-update="{@%}"', {
			'exit_cb': (_, status) => {
				if status == 0
					echo "GTags Update!"
				endif
			}
		})
	endif
enddef

export def GtagsCscope()
	var root = trim(system("global -pq"))
    if v:shell_error != 0
        return 
    endif

	silent! exe $"cs add {root}/GTAGS"
enddef
